package helper

import "regexp"

func IsPhone(phone string) bool {
	regex := regexp.MustCompile(`^1[3-9]\d{9}$`)
	return regex.MatchString(phone)
}

func IsEmail(email string) bool {
	// 正则表达式匹配邮箱格式
	emailRegex := regexp.MustCompile(`^[a-zA-Z0-9.!#$%&'*+/=?^_` + "`" + `{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$`)
	return emailRegex.MatchString(email)
}
